﻿//逻辑代码

import {Puerts, UnityEngine} from "csharp";
import {Component} from "framework/component";
import {$typeof} from "puerts";
import Vector3 = UnityEngine.Vector3;
import Time = UnityEngine.Time;
let count = 0;
class Rotate  extends Component
{
    creator:boolean = false;
    constructor(behaviour:Puerts.JsBehaviour) {
        super(behaviour);
        //继承component不需要自己手动添加钩子赋值,删掉就行. 不然按具体需求打开注释,重写具体方法
    }
    Start(){
        console.log('vvvvvvvvvvvvvvvvvvvvvv' ,this.GetComponent($typeof(Puerts.JsBehaviour)))
        this.creator = count == 0;
    }
    Update() //注册到componentmgr的事件
    {
        //js不支持操作符重载所以Vector3的乘这么用
        let r = Vector3.op_Multiply(Vector3.up, Time.deltaTime * 36);
        this.transform.Rotate(r);
    }

    OnDestroy() {
        console.error('Mainmenu OnDestroy...');
    }
}

export function init (jsBehavior:Puerts.JsBehaviour) {
    new Rotate(jsBehavior);
}
